package com.zoe.app.controller;

import com.zoe.app.eneity.RedPackage;
import com.zoe.app.service.RedPackageServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author zoe.Zhang
 * @date 2023/02/03
 * @description
 */
@RestController
@RequestMapping("/red")
public class RedController {

    @Resource
    private RedPackageServiceImpl redPackageService;

    // http://localhost:8080/red/init
    @GetMapping("/init")
    public int init() {
        return redPackageService.init();
    }

    // http://localhost:8080/red/view
    @GetMapping("/view")
    public Object view() {
        return redPackageService.view();
    }

    @GetMapping("/all")
    public List<RedPackage> redPackages() {
        return redPackageService.getAll();
    }

    //
    @GetMapping("/update")
    public Map<String, Object> update() {
        return redPackageService.update();
    }

    // http://localhost:8080/red/updateLock
    @GetMapping("/updateLock")
    public Map<String, Object> updateLock() {
        return redPackageService.updateLock();
    }

}
